package celiasoft.itasalib.query;

import celiasoft.itasalib.filegatherer.XMLGatherer;
import celiasoft.itasalib.query.resultparser.IQueryResultParser;
import celiasoft.itasalib.query.resultparser.QueryMyItasaShowsResultParser;
import celiasoft.itasalib.staticdata.ItasaStaticUrls;
import celiasoft.itasalib.structures.SubsVersion;

public class MyItasaAddShowQuery extends Query {

	private String _authcode;
	private int _showId;
	private SubsVersion _version;

	public MyItasaAddShowQuery(XMLGatherer gatherer, String apikey) {
		super(gatherer, apikey);
		this._version = SubsVersion.NONE;
	}

	@Override
	protected String getQueryUrl() {
		String url = ItasaStaticUrls.MYITASA_ADD_SHOW_URL;
		if(this._version == SubsVersion.NONE || this._version == null){
			url = url.replace("&version=$s", "");
			return String.format(url, getAPIKey(), this._authcode, this._showId);
		}
		
		return String.format(url, getAPIKey(), this._authcode, this._showId, this._version);
	}

	public String getAuthcodeKey(){
		return this._authcode.toString();
	}
	
	public void setAuthcodeKey(String key){
		this._authcode = key.toString();
	}
	
	
	@Override
	protected IQueryResultParser getResultParser() {
		
		return new QueryMyItasaShowsResultParser();
	}

	/**
	 * @return the showId
	 */
	public int getShowId() {
		return _showId;
	}

	/**
	 * @return the version
	 */
	public SubsVersion getVersion() {
		return _version;
	}

	/**
	 * @param showId the showId to set
	 */
	public void setShowId(int showId) {
		_showId = showId;
	}

	/**
	 * @param version the version to set
	 */
	public void setVersion(SubsVersion version) {
		_version = version;
	}
	
}
